﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using YJKRevitStairs.HYElevator.Manage;

namespace YJKRevitStairs.StairsModel
{
	public class ElevatorSelFilter : ISelectionFilter
	{
		bool ISelectionFilter.AllowElement(Element elem)
		{
			if (elem is Group)
			{
				if ((elem as Group).GroupType.Name.Contains("Elevator"))
				{
					return true;
				}
			}
			else if (elem is FamilyInstance)
			{
				if ((elem.GetEntitySchemaGuids() as List<Guid>).FindIndex((Guid e) => e.CompareTo(ElevatorXDataManager.m_Guid) == 0) != -1)
				{
					return true;
				}
			}
			return false;
		}

		bool ISelectionFilter.AllowReference(Reference reference, XYZ position)
		{
			return true;
		}
	}
}
